﻿<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="MyListings.aspx.vb" Inherits="Week3Wscc.MyListings" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

 
       <h2>
        Showing only Your Listings<br /> 
    </h2>
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    </asp:ToolkitScriptManager>
 <p align="center">
    <b>Click on one of the pictures to access the detailed view of the offer!</b>
    </p>
    <p>

        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            BackColor="White" BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" 
            CellPadding="4" DataSourceID="SqlDataSource1" HorizontalAlign="Center">
            <Columns>
                <asp:BoundField DataField="FoodName" HeaderText="Food Name" 
                    SortExpression="FoodName" />
                <asp:BoundField DataField="FoodBrand" HeaderText="Brand" 
                    SortExpression="FoodBrand" />
                <asp:BoundField DataField="FoodSize" HeaderText="Size" 
                    SortExpression="FoodSize" />
                <asp:BoundField DataField="FoodDescription" 
                    HeaderText="Description" 
                    SortExpression="FoodDescription" />
                <asp:BoundField DataField="FoodBestBefore" HeaderText="Best-Before Date" 
                    SortExpression="FoodBestBefore" />

                <asp:TemplateField>
                <ItemTemplate>
                <a href="FoodDetail.aspx?ID=<%#Eval("ID") %>">
                <img src="<%#Eval("FoodPicture")%>" style="width:200px;height:150px" align="middle" /></a>
                </ItemTemplate>
                </asp:TemplateField>

                 <asp:TemplateField HeaderText="User">
                <ItemTemplate>
                <a href='Profile.aspx?FoodUser=<%# Eval("FoodUser") %>'><%# Eval("FoodUser") %>
                </a>
                </ItemTemplate>
                </asp:TemplateField>

            </Columns>
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <HeaderStyle BackColor="#5078B3" Font-Bold="True" ForeColor="#FFFFCC" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <RowStyle BackColor="White" ForeColor="#330099" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <SortedAscendingCellStyle BackColor="#FEFCEB" />
            <SortedAscendingHeaderStyle BackColor="#AF0101" />
            <SortedDescendingCellStyle BackColor="#F6F0C0" />
            <SortedDescendingHeaderStyle BackColor="#7E0000" />
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:FoodConnectionString %>" 
            ProviderName="<%$ ConnectionStrings:FoodConnectionString.ProviderName %>" 
            SelectCommand="SELECT * FROM [food] WHERE ([FoodUser] = @UserName)">
                        <SelectParameters>
                <put:loginParameter name="UserName" />
            </SelectParameters>
</asp:SqlDataSource>
    </p>
</asp:Content>
